package com.zr.subclass.mapper;

import com.zr.subclass.pojo.SubClass;
import com.zr.subclass.pojo.SubClassSelectVo;
import com.zr.subclass.pojo.SubClassUpdateVo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * Created by 86151 on 2019/6/14.
 */
@Mapper
public interface SubClassMapper {
    @Select("select * from subclass where code = #{code}")
    List<SubClass> queryByCode(String code);

    @Select("select * from subclass where name = #{name}")
    List<SubClass> queryByName(String name);

    @Insert("insert into subclass (name,code,remark,status,createTime,createName,updateTime," +
            "updateName) values (#{name},#{code},#{remark},#{status},#{createTime},#{createName},#{updateTime},#{updateName}) ")
    int addSubClass(SubClass planClass);

    @Select("select * from subclass where id=#{id}")
    SubClass queryById(int id);

    List<SubClass> queryPage(SubClassSelectVo planClassSelectVo);
    int queryCount(SubClassSelectVo planClassSelectVo);

    @Update("update subclass set remark= #{remark},status=#{status},name=#{name} where code = #{code}")
    int updatePlant(SubClass subClass);

    @Update("update subclass set status=#{status} where id = #{id}")
    int updateStatus(SubClass subClass);

    @Select("select * from subclass where id=#{id}")
    SubClass querySubClassById(Integer id);

    @Select("select * from subclass where name =#{name} and  id!=#{id}")
    List<SubClass> queryByAll(SubClassUpdateVo subClassUpdateVo);


}
